<?php
/**
 * @version		$Id: article.php 17111 2010-05-16 22:54:35Z eddieajau $
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.modeladmin');

/**
 * Article model.
 *
 * @package		Joomla.Administrator
 * @subpackage	com_content
 */
class AjaxWhoisModelExtension extends JModelAdmin {
	/**
	 * Returns a reference to the a Table object, always creating it.
	 *
	 * @param	type	The table type to instantiate
	 * @param	string	A prefix for the table class name. Optional.
	 * @param	array	Configuration array for model. Optional.
	 * @return	JTable	A database object
	 * @since	1.6
	 */
	public function getTable($type = 'Extensions', $prefix = 'AjaxWhoisTable', $config = array()) {
		return JTable::getInstance($type, $prefix, $config);
	}
	/**
	 * Method to get the HelloWorld form.
	 *
	 * @access      public
	 * @return      mixed   JForm object on success, false on failure.
	 * @since       1.0
	 */
	public function getForm($data = array(), $loadData = true) {
		$form = $this->loadForm('com_ajaxwhois.extension', 'extension', array('control' => 'jform', 'loadData' => $loadData) );
		if (empty($form)) {
			return false;
		}
		return $form;
	}
	/**
	 * Method to get the data that should be injected in the form.
	 *
	 * @return	mixed	The data for the form.
	 * @since	1.6
	 */
	protected function loadFormData() {
		// Check the session for previously entered form data.
		$data = JFactory::getApplication()->getUserState('com_ajaxwhois.edit.extension.data', array());

		if (empty($data)) {
			$data = $this->getItem();
		}

		return $data;
	}

}
